﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="IndexAlb.aspx.cs" Inherits="MusicSite.Views.Content.Album.IndexAlb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    All albums
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form id="formAlbum" runat="server">
<div>
    <h2>All Albums</h2>
    
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        DataObjectTypeName="Model.Entities.AlbumDetails" DeleteMethod="DeleteAlbum" 
        InsertMethod="InsertAlbum" SelectMethod="GetAlbumsByName" 
        TypeName="Model.AlbumProvider" UpdateMethod="UpdateAlbum">
    <SelectParameters>
        <asp:ControlParameter ControlID="Filtr" Name="albName" PropertyName="Text" 
            Type="String" />
    </SelectParameters>
    <DeleteParameters>
        <asp:Parameter Name="albumId" Type="Int32" />
    </DeleteParameters>
    </asp:ObjectDataSource>
    
</div>
<div>
    <p>
        <asp:Label ID="ErrorName" CssClass="error" runat="server" Text="***Enter album's name please!"></asp:Label>
    </p>
    <p>
        <asp:Label ID="ErrorYear" CssClass="error" runat="server" Text="***Enter album's year please!"></asp:Label>
    </p>
    <p>
        <asp:Label ID="ErrorStyle" CssClass="error" runat="server" Text="***Enter style please!"></asp:Label>
    </p>
    <p>
        <asp:Label ID="ErrorArtName" CssClass="error" runat="server" Text="***Enter artist's name please!"></asp:Label>
    </p>
</div>
<div>
    <fieldset>
        <legend>Search</legend>
        <table>
            <tr>
                <td>Album's name:</td>
                <td><asp:TextBox ID="Filtr" runat="server"></asp:TextBox></td>
            </tr>
        </table>
        <input type="submit" value="Search" />
    </fieldset>
</div>
<asp:GridView ID="GridView1" runat="server" CssClass="index" AutoGenerateColumns="False" DataKeyNames="AlbumId"
    DataSourceID="ObjectDataSource1" onrowupdating="GridView1_RowUpdating" 
        onrowediting="GridView1_RowEditing">
    <Columns>
        <asp:HyperLinkField Text="Edit" DataNavigateUrlFields="AlbumId" HeaderStyle-Width="30px"
            DataNavigateUrlFormatString="~/Views/Content/Album/EditAlb.aspx?albumId={0}"/>
        <asp:imagefield  DataImageUrlField="Cover" DataImageUrlFormatString="~/Content/images/{0}" 
                headertext="Cover" ControlStyle-CssClass="photo" NullImageUrl="~/Content/images/noimage.gif"
                HeaderStyle-Width="100px"/>
        <asp:BoundField DataField="AlbumId" HeaderText="AlbumId" 
            InsertVisible="false" ReadOnly="true" Visible="false" />
        <asp:BoundField DataField="AlbumName" HeaderText="Album name" 
            SortExpression="AlbumName" />
        <asp:BoundField DataField="ReleaseDate" HeaderText="Release date" HeaderStyle-Width="100px"
            DataFormatString="{0:dd/MM/yyyy}" />
        <asp:BoundField DataField="ArtistName" HeaderText="Artist" />
        <asp:BoundField DataField="Style" HeaderText="Style" HeaderStyle-Width="100px"/>
        <asp:HyperLinkField DataNavigateUrlFields="Url" DataTextField="Url" 
            HeaderText="Url" DataNavigateUrlFormatString="{0}" Target="_blank"/>
    </Columns>
</asp:GridView>
<p>
    <asp:HyperLink ID="hyperLink1" runat="server" Text="Create new"  
        NavigateUrl="~/Views/Content/Album/EditAlb.aspx">
    </asp:HyperLink>
</p>
</form>
</asp:Content>
